package com.zk.algo;

import java.util.*;

/**
 * 水仙花树
 *
 * (1) 使用 StringBuilder 来控制空格,格式等问题
 * (2) 一开始想到暴力解法可能不行,于是就放弃了...后来看到别人有用,自己才开始用
 */
public class ShuiXianHuaShu {

    public static void main(String...args) {
        Scanner scanner = new Scanner(System.in);

        int small = scanner.nextInt();
        int big = scanner.nextInt();

        StringBuilder sb = new StringBuilder();

        for (int num = small; num <= big; num++) {
            if (isValid(num)) {
                sb.append(num);
                sb.append(" ");
            }
        }

        if (sb.length() == 0) {
            System.out.println("no");
        } else {
            sb.setLength(sb.length() - 1);
            System.out.println(sb);
        }

    }

    static boolean isValid(int num) {
        char[] charArray = String.valueOf(num).toCharArray();

        int curr = 0;
        for (char c:charArray) {
            int val = (int)(c - '0');
            curr += Math.pow(val, 3);
        }

        return curr == num;
    }

}
